<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>资源管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="${ctx}/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="${ctx}/systemStatic/style/admin.css">
    <link rel="stylesheet" href="${ctx}/extends/zTree_v3/css/zTreeStyle/zTreeStyle.css"/>
    <link rel="stylesheet" href="${ctx}/iconfont/iconfont.css"/>
    <link rel="stylesheet" href="${ctx}/systemStatic/style/iconfont/iconfont.css">
    <link rel="stylesheet" href="${ctx}/css/public.css">
    <script type="text/javascript">
        var __ctx = "${ctx}";
    </script>
</head>
<body>
<div style="position: relative;height: 100%">
    <div class="ccpui-trees">
        <p class="isShowTree colorSwitch">
            <span style="float: left;color: #fff">&nbsp;&nbsp;组织机构</span>
            <i layadmin-event="treeFlexible" class="layui-icon layui-icon-prev"></i>
        </p>
        <div style="margin-top: 6px;">
            <ul class="ccpui-iconTree iconTrees">
                <li><a class="iconfont iconshuaxin- zTree-refresh" title="刷新"></a></li>
                <li><a class="iconfont iconwenjianjia1-copy zTree-triangle-d" title="展开"></a></li>
                <li><a class="iconfont iconfolder1 zTree-triangle-r" title="收起"></a></li>
                <input type="text" style="width: 50%" class="orgZtreeValue">
            </ul>
            <ul id="treeSelectRes" class="ztree ccpui-listZtree" style="padding-right: 10px;"></ul>
        </div>
    </div>
    <div class="ccpui-coreContent" style="padding-left: 10px">
        <div style="width: 100%;background:#ccc;height: 30px;line-height: 30px">资源架构信息</div>
        <div class="ccpui-trees" style="float: left;top:30px;margin-left: 0">
            <p class="isShowTree colorSwitch">
                <span style="float: left;color: #fff">&nbsp;&nbsp;资源树</span>
                <i layadmin-event="treeFlexible" class="layui-icon layui-icon-prev" ></i>
            </p>
            <div style="margin-top: 6px;" >
                <ul class="ccpui-iconTree iconTrees">
                    <li><a class="iconfont iconshuaxin- zTrees-refresh" title="刷新"></a></li>
                    <li><a class="iconfont iconwenjianjia1-copy zTrees-triangle-d" title="展开"></a></li>
                    <li><a class="iconfont iconfolder1 zTrees-triangle-r" title="收起"></a></li>
                    <input type="text" style="width: 50%" class="resZtreeValues">
                </ul>
                <ul id="treeSelectResource" class="ztree ccpui-listZtree"></ul>
                <div class="tenantTit" style="position: absolute;top: 400px;font-size: 18px;color: #aaa;left: 80px;">请选择租户</div>
            </div>
        </div>
        <div style="top: 40px;bottom: 10px;overflow: auto;" id="viewInformation" class="ccpui-coreContent"></div>
    </div>
</div>
<div class="importResources" hidden style="display: none">
    <div >
        <div class="layui-form-item" style="margin-top: 35px;">
            <label class="layui-form-label">选择文件:</label>
            <div class="layui-input-block">
                <input type="file" id="xmlFile" name="xmlFile" />
            </div>
        </div>
        <div style="margin-left: 100px;">
            <button class="layui-btn " type="button" style="margin: 10px" id="resImportForms">导入</button>
            <button class="layui-btn " type="button" style="margin: 10px;display: none;" id="triggerImport"></button>
            <button type="reset" id="resImportCancel" class="layui-btn btn-n layui-btn-danger">取消</button>
        </div>
    </div>
</div>
<div class="menuGenerations" hidden style="display: none">
    <span class="layui-btn saveMenuGeneration" style="margin: 10px">生成</span>
    <div style="margin: 10px;background:#efefef; padding: 10px">
        菜单自动生成功能：填写类路径，地址写法规则为：路径从根开始写，例如 ：<span style="color: red;">com.casic.platform.*.controller.*</span>，
        代码将扫描包路径对应controller类下所有@RequestMapping("*")注解的方法，将每个方法的@RequestMapping("*")对应的值作为资源URL，
        将每个方法的@Action注解中description的值作为资源名称，最终将生成controller类下所有带有@RequestMapping("*")的方法的资源菜单信息。
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">类路径:</label>
        <div class="layui-input-block" style="width: 80%">
            <input type="text" class="layui-input menuGeneration">
        </div>
    </div>
</div>
<div id="resRightMenus">
    <ul>
        <li id="addNode">增加节点</li>
        <li id="editNode">修改节点</li>
        <li id="removeNode">删除节点</li>
        <li id="importResources">导入资源</li>
        <li id="exportResources">导出资源</li>
        <li id="nodeSorting">节点排序</li>
        <li id="menuGeneration">菜单生成</li>
        <li id="moveNode">移动节点</li>
    </ul>
</div>
<div class="nodeSorting" hidden style="display: none">
    <div class="selcetData">
        <table style="width:100%">
            <tr>
                <td class="right ccpui-sortFunction" style="padding: 0">
                    <ul class="rightData" style="margin-top: 10px">
                    </ul>
                </td>
                <td class="left">
                    <span class="layui-btn moveTop">顶部</span>
                    <span class="layui-btn moveUp">向上</span>
                    <span class="layui-btn moveDown">向下</span>
                    <span class="layui-btn moveBottom">底部</span>
                </td>
            </tr>
        </table>
    </div>
    <div style="margin: 14px;text-align: center">
        <button class="layui-btn saveNodeSorting">保存</button>
        <button class="layui-btn cancelNodeSorting layui-btn-danger">取消</button>
    </div>
</div>
<div class="menuGenDetermine" hidden style="display: none">
    <p style="margin: 10px">将生成如下菜单</p>
    <div id="menuGenDetermine"></div>
    <div style="text-align:right ;margin: 10px">
        <button class="layui-btn saveMenus">确定</button>
    </div>
</div>
<div class="resShowHideOpen" style="display: none">
    <div class="ccpui-trees" style="width: 100%;top: 0px;bottom: 60px;margin-left: 0">
        <p class="isShowTree colorSwitch"><span style="float: left;color: #fff">&nbsp;&nbsp;资源树</span></p>
        <div style="margin-top: 6px;" >
            <ul class="ccpui-iconTree iconTrees">
                <li><a class="iconfont iconshuaxin- zTrees-refreshOpen" title="刷新"></a></li>
                <li><a class="iconfont iconwenjianjia1-copy zTrees-triangle-dOpen" title="展开"></a></li>
                <li><a class="iconfont iconfolder1 zTrees-triangle-rOpen" title="收起"></a></li>
                <input type="text" style="width: 50%" class="resZtreeValuesOpen">
            </ul>
            <ul id="treeSelectResourceOpen" class="ztree ccpui-listZtree"></ul>
        </div>
    </div>
    <div class="bottom" style="position: absolute;bottom:15px;width:100%;text-align: center">
        <button class="layui-btn saveDataOpen" >保存</button>
        <button class="layui-btn  layui-btn-danger cancelDataOpen" >取消</button>
    </div>
</div>
<input type="hidden" id="resIdSelect">
<input type="hidden" id="resParentId">
<input type="hidden" id="orgIdSelect">
<input type="hidden" id="selectTenantId" name="selectTenantId">

<script src="${ctx}/extends/jquery.min.js" type="text/javascript"></script>
<script src="${ctx}/public/component.js" type="text/javascript"></script>
<script src="${ctx}/layui/layui.js"></script>
<script src="${ctx}/extends/zTree_v3/js/jquery.ztree.all.min.js" type="text/javascript"></script>
<script src="${ctx}/extends/zTree_v3/js/jquery.ztree.exhide.min.js" type="text/javascript"></script>
<script>
    layui.config({
        base: serverPath.systemPath + staticPath.systemPath //静态资源所在路径
    }).extend({
        index: 'index' //主入口模块
    }).use(['index','table', 'layer', 'form', 'setter', 'upload', 'commons'], function () {
        var table = layui.table, layer = layui.layer, form = layui.form, $ = layui.jquery,
            setter = layui.setter, upload = layui.upload, commons = layui.commons;
        form.render();
        //选中的左侧角色树的节点ID
        var selectOrgId = "";
        var selectTenantId = "";
        var selectResId = "";//资源树id
        var selectResIdOpen = "";//移动节点资源树id
        var parentIds = "";//节点父id
        var ztreeNode;//全局参数
        // $('body > .importResources').remove();
        // $('body').append($('.importResources'));
        // $('body > .nodeSorting').remove();
        // $('body').append($('.nodeSorting'));
        // $('body > .menuGenerations').remove();
        // $('body').append($('.menuGenerations'));
        // $('body > .menuGenDetermine').remove();
        // $('body').append($('.menuGenDetermine'));
        // $('body > .resShowHideOpen').remove();
        // $('body').append($('.resShowHideOpen'));

        orgZtrees();  //树状结构
        function orgZtrees() {
            $.ajax({
                url: serverPath.systemPath + setter.sysLinkPath + "sysOrg/list",
                type: "get",
                contentType: 'application/json',
                dataType: 'json',
                success: function (data) {
                    var zNodes = data.data;
                    var setting = {
                        view:{
                            nameIsHTML: true
                        },
                        edit: {
                            enable: false,
                            editNameSelectAll: false
                        },
                        data: {
                            simpleData: {
                                enable: true,
                                idKey:"orgId",
                                pIdKey:"orgSupId"
                            }
                        },
                        callback: {
                            onClick: onClickRess
                        }
                    };
                    $.fn.zTree.init($('#treeSelectRes'), setting, zNodes);
                    component.fuzzySearch('treeSelectRes', '.orgZtreeValue', null, true); //初始化模糊搜索方法
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    layer.alert("暂无数据，请稍后操作！" + XMLHttpRequest.status);
                },
            });
        }

        //展开
        $(".iconTrees .zTree-triangle-d").click(function () {
            $.fn.zTree.getZTreeObj("treeSelectRes").expandAll(true);
        });
        //收起
        $(".iconTrees .zTree-triangle-r").click(function () {
            $.fn.zTree.getZTreeObj("treeSelectRes").expandAll(false);
        });
        //刷新
        $(".iconTrees .zTree-refresh").click(function () {
            orgZtrees();
        });


        //resZtrees();
        layui.resZteeRef = function () {
            resZtrees();
        };

        function resZtrees() {
            $.ajax({
                url: serverPath.systemPath + setter.sysLinkPath + "sysRes/listTenantRes?orgId=" + selectOrgId,
                type: "get",
                dataType: 'json',
                success: function (data) {
                    var zNodes = data.data;
                    var setting = {
                        view: {
                            showLine: true,
                            nameIsHTML: true, //允许name支持html
                            selectedMulti: false,
                            showIcon: showIconForTree
                        },
                        edit: {
                            enable: false,
                            editNameSelectAll: false
                        },
                        data: {
                            simpleData: {
                                enable: true,
                                idKey: "resId",
                                pIdKey: "parentId"
                            }
                        },
                        callback: {
                            onClick: onClickResouse,
                            onRightClick: OnRightClickres
                        }
                    };
                    var ztreeOpen = $.fn.zTree.init($('#treeSelectResource'), setting, zNodes);
                    ztreeOpen.expandAll(false);
                    expandRootNode('treeSelectResource');
                    component.fuzzySearch('treeSelectResource', '.resZtreeValues', null, true); //初始化模糊搜索方法
                },
            });
            function showIconForTree(treeId, treeNode) {
                return treeNode.iconSkin==null;
            };
        }
        var moveDialogIndex;
        $("#moveNode").click(function () {
            $('#resParentId').val(parentIds);
            $('#resIdSelect').val(selectResId);
            if (!ztreeNode.parentId) {
                layer.alert("根节点不能移动！");
                return false;
            }
            resZtreesOpen();
            moveDialogIndex = layer.open({
                type: 1,
                area: ['300px', '600px'],
                title: ['移动节点', 'font-size:18px;'],
                content: $(".resShowHideOpen")
            });
            hideRMenu();
            return false;
        });
        function resZtreesOpen() {
            $.ajax({
                url: serverPath.systemPath + setter.sysLinkPath + "sysRes/listTenantRes?orgId=" + selectOrgId,
                type: "get",
                dataType: 'json',
                async:false,
                success: function (data) {
                    var zNodes = data.data;
                    var setting = {
                        view: {
                            showLine: true,
                            nameIsHTML: true, //允许name支持html
                            selectedMulti: false,
                            showIcon: showIconForTreeOpen
                        },
                        edit: {
                            enable: false,
                            editNameSelectAll: false
                        },
                        data: {
                            simpleData: {
                                enable: true,
                                idKey: "resId",
                                pIdKey: "parentId"
                            }
                        },
                        callback:{
                            onClick: zTreeOnLeftClickOpen,
                            onAsyncSuccess: expandRootNode
                        }
                    };
                    var ztreeOpen = $.fn.zTree.init($('#treeSelectResourceOpen'), setting, zNodes);
                    ztreeOpen.expandAll(false);
                    // expandRootNode('treeSelectResourceOpen');
                    component.fuzzySearch('treeSelectResourceOpen', '.resZtreeValuesOpen', null, true); //初始化模糊搜索方法
                }
            });
            function showIconForTreeOpen(treeId, treeNode) {
                return treeNode.iconSkin==null;
            }
        }
        function expandRootNode(treeName){
            var treeObj = $.fn.zTree.getZTreeObj(treeName);
            if(treeObj){
                var nodes = treeObj.getNodes();
                if(nodes.length > 0) {
                    treeObj.expandNode(nodes[0], true, false, true);
                }
            }
        }
        //右键菜单
        function OnRightClickres(event, treeId, treeNode) {
            if (treeNode && !treeNode.noR) {
                ztreeNode=treeNode;
                selectResId=treeNode.resId;
                parentIds=treeNode.parentId;
                if(null == parentIds){
                    parentIds=setter.defaultTopResourceId;
                }
                showRMenus(event.clientX, event.clientY);
            }
        }

        function onClickResouse(event, treeId, treeNode) {
            var selectResIdRight = treeNode.resId;
            $('#resIdSelect').val(selectResIdRight);
            $('#viewInformation').load(serverPath.systemPath + setter.sysLinkPath +'sysRes/view/view');
        }

        function zTreeOnLeftClickOpen(event, treeId, treeNode) {
            selectResIdOpen = treeNode.resId;
        }



        function showRMenus(x, y) {
            $("#resRightMenus ul").show();
            var h = $('#resRightMenus').height();
            x += 15;
            y += 10;
            if ($(window).height() < y + h) (
                y = y - h
            );
            $("#resRightMenus").css({"top": y + "px", "left": x + "px", "visibility": "visible"});
            $("body").bind("mousedown", onBodyMouseDown);
        }

        function onClickRess(event, treeId, treeNode, clickFlag) {
            console.log(treeNode);
            selectOrgId = treeNode.orgId;
            selectTenantId = treeNode.tenantId;
            if(selectOrgId){
                $(".tenantTit").css('display','none');
            }else{
                $(".tenantTit").css('display','block');
            }
            $("#orgIdSelect").val(selectOrgId);
            $("#selectTenantId").val(selectTenantId);
            if (treeNode.isTenant === 1) {
                resZtrees();
            } else {
                layer.alert("非租户无资源");
            }
        }

        function hideRMenu() {
            if ($("#resRightMenus")) $("#resRightMenus").css({"visibility": "hidden"});
            $("body").unbind("mousedown", onBodyMouseDown);
        }

        function onBodyMouseDown(event) {
            if (!(event.target.id == "orgRightMenu" || $(event.target).parents("#resRightMenus").length > 0)) {
                $("#resRightMenus").css({"visibility": "hidden"});
            }
        }

        ///增加节点
        $("#addNode").click(function () {
            $('#resParentId').val("");
            $('#resIdSelect').val(selectResId);
            $('#viewInformation').load(serverPath.systemPath + setter.sysLinkPath +'sysRes/view/add');
            hideRMenu();
            return false;
        });
        ///修改节点
        $("#editNode").click(function () {
            $('#resIdSelect').val(selectResId);
            $('#resParentId').val(parentIds);
            $('#viewInformation').load(serverPath.systemPath + setter.sysLinkPath +'sysRes/view/add');
            hideRMenu();
            return false;
        });
        $("#removeNode").click(function () {//删除节点
            if (ztreeNode.parentId == "0") {
                layer.alert("根节点不能删除");
            } else {
                if ( $.fn.zTree.getZTreeObj("treeSelectResource").transformToArray(ztreeNode).length>1) {
                    layer.alert("父节点不能删除");
                } else {
                    layer.confirm('确定删除当前数据吗？', function (index) {
                        layer.close(index);
                        $.ajax({
                            url: serverPath.systemPath + setter.sysLinkPath + "sysRes/del",
                            type: "post",
                            dataType:'json',
                            data: {resId: selectResId},
                            success: function (data) {
                                if (commons._filterRecord(data)) {
                                    var treeObj = $.fn.zTree.getZTreeObj("treeSelectResource");
                                    treeObj.removeNode(ztreeNode);
                                }
                                layer.alert(data.msg);
                            },
                        });
                    });
                }
            }
        });
        var importIndex;
        $("#importResources").click(function () {//导入资源
            $("#xmlFile").val("");
            importIndex = layer.open({
                type: 1,
                area: ['400px', '210px'],
                title: ['导入资源'],
                content: $(".importResources")
            });
        });
        $("#resImportForms").click(function () {
            if($("#xmlFile").val() != ""){
                $("#triggerImport").click();
            }else{
                layer.alert("未选择文件!");
            }
        });
        upload.render({//导入文件
            elem: '#xmlFile'
            , url: serverPath.systemPath + setter.sysLinkPath + "sysRes/importXml"
            , accept: 'file'
            , multiple: true
            , auto: false
            , bindAction: '#triggerImport'
            , method: 'post'
            , number:3
            , before: function (obj) {
                console.log($("#selectTenantId").val());
                this.data ={"systemId":1,
                    "resId":selectResId,
                    "importType":$("input[name='importType']:checked").val(),
                    "selectTenantId":$("#selectTenantId").val()};
            }
            , done: function (result) {
                if(commons._filterRecord(result)){
                    layer.alert(result.msg,function(index){
                        layer.close(index);
                        layer.close(importIndex);
                        resZtrees();
                    });
                }
            }
        });

        //关闭弹框
        $("#resImportCancel").click(function () {
            layer.close(importIndex);
        });

        $("#exportResources").click(function () {//导出资源
            layer.confirm('确定导出吗？', {}, function (index) {
                layer.close(index);
                var url = serverPath.systemPath + setter.sysLinkPath + "sysRes/exportXml?resId=" + selectResId + "&orgId=" + selectOrgId;// orgId是当前所属组织的id
                window.location.href = url;
            });
        });
        var nodeSors;//关闭节点排序弹窗
        $("#nodeSorting").click(function () {//节点排序
            var childNodes = $.fn.zTree.getZTreeObj("treeSelectResource").transformToArray(ztreeNode);
            if (childNodes.length > 1) {
                nodeSors = layer.open({
                    type: 1,
                    area: ['500px', '480px'],
                    title: ['节点排序'],
                    content: $(".nodeSorting"),
                    success: function () {
                        $(".right .rightData").empty();
                        var optionData = "";
                        for (var i = 0; i < ztreeNode.children.length; i++) {
                            $(".right .rightData").append('<li class="" value="'+ztreeNode.children[i].resId+'">'+ztreeNode.children[i].name+'</li>')
                        }
                    }
                });
            } else {
                layer.alert("当前没有子节点");
            }
            hideRMenu();
        });
        $(".saveNodeSorting").click(function () {
            var resIds = [];
            $('.right .rightData li').each(function () {
                resIds.push($(this).attr('value'));
            });
            $.ajax({
                url: serverPath.systemPath + setter.sysLinkPath + "sysRes/sort",
                type: "post",
                dataType: 'json',
                data: {
                    resId: selectResId,
                    resIds: resIds.join(",")
                },
                success: function (data) {
                    if (commons._filterRecord(data)) {
                        layer.alert(data.msg, function (index) {
                            layer.close(index);
                            layer.close(nodeSors);
                            resZtrees();
                        });
                    } else {
                        layer.alert(data.msg);
                    }
                },
            });
        });
        $(".saveDataOpen").click(function () {
            if(!selectResIdOpen){
                layer.alert("请选择目标父节点！");
                return false;
            }
            if(selectResId == selectResIdOpen){
                layer.alert("移动节点不能等于目标节点！");
                return false;
            }

            $.ajax({
                url: serverPath.systemPath + setter.sysLinkPath + "sysRes/move",
                type: "post",
                dataType: 'json',
                data: {
                    sourceId: selectResId,
                    targetId: selectResIdOpen
                },
                success: function (data) {
                    if (commons._filterRecord(data)) {
                        layer.alert(data.msg, function (index) {
                            layer.close(index);
                            layer.close(moveDialogIndex);
                            resZtrees();
                        });
                    } else {
                        layer.alert(data.msg);
                    }
                }
            });
        });
        $(".cancelDataOpen").click(function () {
            layer.close(moveDialogIndex);
            selectResIdOpen = "";
        });
        $(".cancelNodeSorting").click(function () {
            layer.close(nodeSors);
        });

        $(document).on('click','.right .rightData  li',function () {
            $('.right .rightData  li').removeClass('selectIndex');
            $(this).addClass('selectIndex');
        });
        $(document).on('click','.layui-btn.moveTop',function () {
            $('.right .rightData li:first-child').before($('.selectIndex'))
        });
        $(document).on('click','.layui-btn.moveBottom',function () {
            $('.right .rightData li:last-child').after($('.selectIndex'))
        });
        $(document).on('click','.layui-btn.moveUp',function () {
            var index = $('.selectIndex').index() - 1;
            if(index > -1){
                $('.right .rightData li').eq(index).before($('.selectIndex'))
            }
        });
        $(document).on('click','.layui-btn.moveDown',function () {
            var index = $('.selectIndex').index() + 1;
            $('.right .rightData li').eq(index).after($('.selectIndex'))
        });
        var indexGeneration;
        $("#menuGeneration").click(function () {//菜单生成
            var valData = $(".menuGeneration").val();
            indexGeneration = layer.open({
                type: 1,
                area: ['860px', '300px'],
                title: ['菜单生成', 'font-size:18px;'],
                content: $(".menuGenerations")
            });
            return false
        });
        var indexMenu;
        $(".saveMenuGeneration").click(function () {
            var valData=$(".menuGeneration").val();
            $.ajax({
                url: serverPath.systemPath + setter.sysLinkPath + "sysRes/validClass",
                type: "get",
                dataType: 'json',
                data: {parentId: selectResId,className:valData},
                success: function (dataValid) {
                    if (commons._filterRecord(dataValid)) {
                        indexMenu= layer.open({
                            type: 1,
                            area: ['340px', '310px'],
                            title: ['提示信息', 'font-size:18px;'],
                            content: $(".menuGenDetermine"),
                            success:function (data) {
                                generatorMenu(valData);
                            }
                        });
                    } else {
                        layer.alert(dataValid.msg);
                    }
                },
            });
        });
        //生成菜单 生成菜单前先列出即将生成那些菜单
        function generatorMenu(valData){
            $.ajax({
                url:serverPath.systemPath + setter.sysLinkPath + "sysRes/getAllMenuPath",
                type:"post",
                dataType: 'json',
                data:{className:valData},
                success:function(dataAllMenu){
                    $("#menuGenDetermine").html(dataAllMenu.msg);
                    $(".saveMenus").click(function () {
                        autoGenMenu(valData);
                    })
                }
            });
        }
        //生成菜单 最终将菜单数据入数据库
        function autoGenMenu(valData){
            $.ajax({
                url:serverPath.systemPath + setter.sysLinkPath + "sysRes/menuAutoGen",
                type: "post",
                dataType: 'json',
                data: {parentId: selectResId,className:valData,orgId:selectOrgId},
                success: function (dataGen) {
                    if (commons._filterRecord(dataGen)) {
                        layer.alert(dataGen.msg,function (index) {
                            layer.close(index);
                            layer.close(indexMenu);
                            layer.close(indexGeneration);
                            resZtrees();
                        });
                    } else {
                        layer.alert(dataGen.msg);
                    }
                },
            });
        }
        //展开
        $(".iconTrees .zTrees-triangle-d").click(function () {
            $.fn.zTree.getZTreeObj("treeSelectResource").expandAll(true);
        });
        //收起
        $(".iconTrees .zTrees-triangle-r").click(function () {
            $.fn.zTree.getZTreeObj("treeSelectResource").expandAll(false);
        });
        //刷新
        $(".iconTrees .zTrees-refresh").click(function () {
            resZtrees();
        });

        //展开
        $(".iconTrees .zTrees-triangle-dOpen").click(function () {
            $.fn.zTree.getZTreeObj("treeSelectResourceOpen").expandAll(true);
        });
        //收起
        $(".iconTrees .zTrees-triangle-rOpen").click(function () {
            $.fn.zTree.getZTreeObj("treeSelectResourceOpen").expandAll(false);
        });
        //刷新
        $(".iconTrees .zTrees-refreshOpen").click(function () {
            resZtreesOpen();
        });

    })
</script>
<style>
    div#resRightMenus {
        position: fixed;
        border: 1px solid #ccc;
        z-index: 900;
        visibility: hidden;
        top: 0;
        background-color: #f5f5f5;
        text-align: left;
        padding: 2px;
    }

    div#resRightMenus ul li {
        margin: 5px 0;
        padding: 0 8px;
        cursor: pointer;
        list-style: none outside none;
    }

    /*节点排序*/
    .nodeSorting div.selcetData .right .rightData {
        height: 358px;
        margin-left: 20px;
        overflow: auto;
        width: 100%;
        border: 1px solid #C0C4CC;
    }

    .right .rightData  li{
        cursor: pointer;
    }

    .nodeSorting div.selcetData .left {
        width: 200px;
        height: 360px;
        text-align: center;
    }

    .nodeSorting div.selcetData .left span {
        width: 70px;
        margin: 10px 60px;
    }
    #menuGenDetermine {
        width: 300px;
        height: 140px;
        padding: 8px;
        margin: 0 10px;
        border: 1px solid #ccc;
        overflow: auto;
    }
</style>
</body>
</html>